package com.example.userlogindemo.CrosConfig;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CrosConfig implements WebMvcConfigurer {
    // 注意下方代码并没有经过实际测试
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowCredentials(true)
                .allowedMethods("POST", "HEAD", "GET", "PUT", "OPTIONS", "DELETE")
                .maxAge(3600)
                .allowedOriginPatterns("*");
    }
}
